package cn.rjzjh.tapestry.busi.model.ca;

// Generated 2014-9-6 10:25:55 by Hibernate Tools 4.0.0

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * CaPosition generated by hbm2java
 */
@Entity
@Table(name = "CA_Position")
public class CaPosition implements java.io.Serializable {

	private int id;
	private CaOrganization caOrganization;
	private String positionName;
	private Set<CaStaffPosition> caStaffPositions = new HashSet<CaStaffPosition>(
			0);

	public CaPosition() {
	}

	public CaPosition(int id) {
		this.id=id;
	}

	public CaPosition(int id, CaOrganization caOrganization, String positionName) {
		this.id = id;
		this.caOrganization = caOrganization;
		this.positionName = positionName;
	}

	public CaPosition(int id, CaOrganization caOrganization,
			String positionName, Set<CaStaffPosition> caStaffPositions) {
		this.id = id;
		this.caOrganization = caOrganization;
		this.positionName = positionName;
		this.caStaffPositions = caStaffPositions;
	}

	@Id()
	@Column(name = "id", unique = true, nullable = false, insertable = false, updatable = false)
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "orgId", nullable = false)
	public CaOrganization getCaOrganization() {
		return this.caOrganization;
	}

	public void setCaOrganization(CaOrganization caOrganization) {
		this.caOrganization = caOrganization;
	}

	@Column(name = "positionName", nullable = false, length = 50)
	public String getPositionName() {
		return this.positionName;
	}

	public void setPositionName(String positionName) {
		this.positionName = positionName;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "caPosition", cascade = { CascadeType.REMOVE })
	public Set<CaStaffPosition> getCaStaffPositions() {
		return this.caStaffPositions;
	}

	public void setCaStaffPositions(Set<CaStaffPosition> caStaffPositions) {
		this.caStaffPositions = caStaffPositions;
	}

}
